package com.example.origin.demo.demo;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.concurrent.TimeUnit;

@RequestMapping("JsonExistDemo")
@RestController
public class JsonExistDemo {

    public static void main(String[] args) {
        JsonExistDemo jsonExistDemo = new JsonExistDemo();
        jsonExistDemo.test();
    }


    @SneakyThrows
    @GetMapping("test")
    public void test() {

        String json = "[\"603686\",\"002641\",\"603538\",\"301309\",\"603309\",\"603938\",\"300894\",\"000905\",\"603987\",\"301258\",\"301089\",\"002772\",\"301278\",\"301257\",\"002724\",\"600643\",\"600618\",\"300869\",\"300837\",\"600682\",\"688663\",\"688626\",\"000821\",\"002644\",\"301371\",\"601089\",\"600537\",\"600523\",\"300982\",\"688566\",\"688598\",\"002918\",\"002922\",\"002950\",\"002940\",\"002961\",\"605286\",\"688410\",\"300776\",\"300393\",\"300457\",\"688273\",\"300434\",\"300443\",\"600267\",\"688186\",\"002250\",\"300569\",\"603105\",\"300179\",\"603185\",\"688063\",\"300219\",\"002550\",\"603093\",\"300314\",\"603876\",\"300804\",\"003027\",\"000655\"]";



                String text = "001217\n" +
                "600168\n" +
                "605158\n" +
                "603125\n" +
                "000973\n" +
                "600283\n" +
                "600526\n" +
                "600676\n" +
                "300804\n" +
                "600469\n" +
                "600774\n" +
                "603680\n" +
                "000910\n" +
                "603386\n" +
                "300976\n" +
                "605389";
        JSONArray jsonArray = JSONUtil.parseArray(json);
        String[] split = text.split("\n");
        for (int i = 0; i < split.length; i++) {
            String e = split[i];
            if (jsonArray.contains(e)) {
                System.out.println(i+1+" not exist:"+e);
            }else {
                System.out.println(i+1+" exist:"+e);
            }
        }


    }


}
